package com.wgy.day29多线程.解决线程安全问题的方式.静态同步方法;

/**
 * Created by pc on 2020/11/27 23:37
 * Description: LearningJava
 */
/*
静态同步方法
锁对象是谁?
不能是this
this是创建对象之后产生的,静态方法优先于对象
静态方法的锁对象是本类的class属性,-->class文件对象(反射)
*/
public class Demo03StaticSynchronized {
    public static void main(String[] args) {
        RunnableImpl run = new RunnableImpl();
        System.out.println(run);
        Thread t0 = new Thread(run);
        Thread t1 = new Thread(run);
        Thread t2 = new Thread(run);

        t0.start();
        t1.start();
        t2.start();


    }

}
